package com.tiyende.credit.loop.sdk.dec.userdec

import android.content.Context
import android.os.Build
import com.google.gson.Gson

/**
 * device
 */
class TiyendeUserDecType1(val context: Context, val product: String, val token: String, val path: String) {

    fun getUserDecType1Data(): String? {
        return try {
            val data = hashMapOf<String, Any>().apply {
                put("path", path)
                put("token", token)
                put("product", product)
                put("imei", "")
                put("version", "30")
                put("app", product)
                put("manufacturer", Build.MANUFACTURER ?: "")
                put("brand", Build.BRAND ?: "")
                put("deviceName", Build.DEVICE ?: "")
                put("phoneModel", Build.PRODUCT ?: "")
                put("sysVersion", Build.VERSION.RELEASE ?: "")
                put("mac", TiyendeUserDecDataUtils.getUserDec35())
                put("laguage", TiyendeUserDecDataUtils.getUserDec3())
                put("area", TiyendeUserDecDataUtils.getUserDec19())
                put("screenHeight", TiyendeUserDecDataUtils.getUserDec17(context))
                put("screenWidth", TiyendeUserDecDataUtils.getUserDec18(context))
                put("networkData", TiyendeUserDecDataUtils.getUserDec9(context))
                put("frontCameraPixels", TiyendeUserDecDataUtils.getUserDec29(context))
                put("rearCameraPixels", TiyendeUserDecDataUtils.getUserDec30(context))
                put("ram", TiyendeUserDecDataUtils.getUserDec48(context))
                put("rom", TiyendeUserDecDataUtils.getUserDec51())
                put("ip", TiyendeUserDecDataUtils.getUserDec36(context))
                put("ip2", TiyendeUserDecDataUtils.getUserDec36(context))
                put("networkEnvironment", TiyendeUserDecDataUtils.getUserDec8(context))
                put("cpu", TiyendeUserDecDataUtils.getUserDec16())
            }
            Gson().toJson(data).trim()

        } catch (e: Exception) {
            null
        }
    }
}